#pragma once
#include <string>
#include <vector>
// User表
#pragma db object
class User {
public:
    User(const std::string &em, const std::string &ava, const std::string &un, const std::string &pwd, const std::string vers)
        : email(em), avatar(ava), username(un), password(pwd), version(vers) {
    }
    User() {
    }
#pragma db id type("VARCHAR(255)")
    std::string email;

#pragma db unique type("VARCHAR(255)")
    std::string avatar;

#pragma db index type("VARCHAR(255)")
    std::string username;

#pragma db not_null type("VARCHAR(255)")
    std::string password;

#pragma db type("VARCHAR(255)")
    std::string version;
};
// 用户状态描述表
#pragma db object
class UserStatsSummary {
public:
    UserStatsSummary() {
    }

    UserStatsSummary(const std::string &email, int solved, int attempting, int published, int draft, int following, int followers, int mutual)
        : email(email), solved_problems(solved), attempting_problems(attempting), published_blogs(published), draft_blogs(draft),
          following(following), followers(followers), mutual_friends(mutual) {
    }

#pragma db id type("VARCHAR(255)")
    std::string email;

    int solved_problems = 0;
    int attempting_problems = 0;
    int published_blogs = 0;
    int draft_blogs = 0;
    int following = 0;
    int followers = 0;
    int mutual_friends = 0;
    int blog_likes_number = 0;
};

// 用户默认头像表
#pragma db object
class UserDefaultAvatar {
public:
    UserDefaultAvatar() {
    }

    UserDefaultAvatar(const std::string& am)
        :avatar_md5(am){
    }

#pragma db id auto 
    size_t num;

#pragma db type("VARCHAR(255)")
    std::string avatar_md5;
};

// 用户关注信息表
// ===============================================================
//        follower(关注者)             following(关注者关注的人)
//            110           (关注了)        196
// ===============================================================
#pragma db object
class UserFollowInfo {
public:
    UserFollowInfo() {}

    UserFollowInfo(const std::string& fler, const std::string& fling)
        : follower(fler), following(fling) {}

    #pragma db id auto
    unsigned long id;

    #pragma db type("VARCHAR(255)")
    #pragma db index
    std::string follower;

    #pragma db type("VARCHAR(255)")
    #pragma db index
    std::string following;
};


